home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / host contacted / jikes.lha / jikes-1.11 / src / jcl / jcl_bc_op.cpp < prev    next >
C/C++ Source or Header  |  1999-11-04  |  26KB  |  584 lines

  1. // $Id: jcl_bc_op.cpp,v 1.1 1999/11/04 18:48:03 shields Exp $
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler
  4. // License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1998, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <iostream.h>
  13. #include <string.h>
  14. #include "jcl_bc_op.h"
  15.  
  16.  
  17. void opdesc(int opc,char **name, char **desc)
  18. {
  19.         struct op_entry {
  20.                 char *op_name;
  21.                 char *op_desc;
  22.         };
  23.         struct op_entry table[] = {
  24.                 {"nop",  "do nothing"},
  25.   {"aconst_null",  "push null"},
  26.   {"iconst_m1",  "push int constant -1"},
  27.   {"iconst_0",  "push int constant 0"},
  28.   {"iconst_1",  "push int constant 1"},
  29.   {"iconst_2",  "push int constant 2"},
  30.   {"iconst_3",  "push int constant 3"},
  31.   {"iconst_4",  "push int constant 4"},
  32.   {"iconst_5",  "push int constant 5"},
  33.   {"lconst_0",  "push long constant 0"},
  34.   {"lconst_1",  "push long constant 1"},
  35.   {"fconst_0",  "push float 0.0"},
  36.   {"fconst_1",  "push float 1.0"},
  37.   {"fconst_2",  "push float 2.0"},
  38.   {"dconst_0",  "push double 0.0 onto stack"},
  39.   {"dconst_1",  "push double 1.0 onto stack"},
  40.   {"bipush",  "push byte"},
  41.   {"sipush",  "push short"},
  42.   {"ldc",  "push item from constant pool"},
  43.   {"ldc_w",  "push item from constant pool (wide index)"},
  44.   {"ldc2_w",  "push long or double from constant pool (wide index)"},
  45.   {"iload",  "load int from local variable"},
  46.   {"lload",  "load long from local variable"},
  47.   {"fload",  "load float from local variable"},
  48.   {"dload",  "load double from local variable"},
  49.   {"aload",  "load reference from local variable"},
  50.   {"iload_0",  "load int from local variable 0"},
  51.   {"iload_1",  "load int from local variable 1"},
  52.   {"iload_2",  "load int from local variable 2"},
  53.   {"iload_3",  "load int from local variable 3"},
  54.   {"lload_0",  "load long from local variable 0"},
  55.   {"lload_1",  "load long from local variable 1"},
  56.   {"lload_2",  "load long from local variable 2"},
  57.   {"lload_3",  "load long from local variable 3"},
  58.   {"fload_0",  "load float from local variable 0"},
  59.   {"fload_1",  "load float from local variable 1"},
  60.   {"fload_2",  "load float from local variable 2"},
  61.   {"fload_3",  "load float from local variable 3"},
  62.   {"dload_0",  "load double from local variable 0"},
  63.   {"dload_1",  "load double from local variable 1"},
  64.   {"dload_2",  "load double from local variable 2"},
  65.   {"dload_3",  "load double from local variable 3"},
  66.   {"aload_0",  "load reference from local variable 0"},
  67.   {"aload_1",  "load reference from local variable 1"},
  68.   {"aload_2",  "load reference from local variable 2"},
  69.   {"aload_3",  "load reference from local variable 3"},
  70.   {"iaload",  "load int from array"},
  71.   {"laload",  "load long from array"},
  72.   {"faload",  "load float from array"},
  73.   {"daload",  "load double from array"},
  74.   {"aaload",  "load reference from array"},
  75.   {"baload",  "load byte from array"},
  76.   {"caload",  "load char from array"},
  77.   {"saload",  "load short from array"},
  78.   {"istore",  "store int into local variable"},
  79.   {"lstore",  "store long into local variable"},
  80.   {"fstore",  "store float into local variable"},
  81.   {"dstore",  "store double into local variable"},
  82.   {"astore",  "store reference into local variable"},
  83.   {"istore_0",  "store int into local variable 0"},
  84.   {"istore_1",  "store int into local variable 1"},
  85.   {"istore_2",  "store int into local variable 2"},
  86.   {"istore_3",  "store int into local variable 3"},
  87.   {"lstore_0",  "store long into local variable 0"},
  88.   {"lstore_1",  "store long into local variable 1"},
  89.   {"lstore_2",  "store long into local variable 2"},
  90.   {"lstore_3",  "store long into local variable 3"},
  91.   {"fstore_0",  "store float into local variable 0"},
  92.   {"fstore_1",  "store float into local variable 1"},
  93.   {"fstore_2",  "store float into local variable 2"},
  94.   {"fstore_3",  "store float into local variable 3"},
  95.   {"dstore_0",  "store double into local variable 0"},
  96.   {"dstore_1",  "store double into local variable 1"},
  97.   {"dstore_2",  "store double into local variable 2"},
  98.   {"dstore_3",  "store double into local variable 3"},
  99.   {"astore_0",  "store reference into local variable 0"},
  100.   {"astore_1",  "store reference into local variable 1"},
  101.   {"astore_2",  "store reference into local variable 2"},
  102.   {"astore_3",  "store reference into local variable 3"},
  103.   {"iastore",  "store into int array"},
  104.   {"lastore",  "store into long array"},
  105.   {"fastore",  "store into float array"},
  106.   {"dastore",  "store into double array"},
  107.   {"aastore",  "store into reference array"},
  108.   {"bastore",  "store into byte array"},
  109.   {"castore",  "store into char array"},
  110.   {"sastore",  "store into short array"},
  111.   {"pop",  "pop top operand stack word"},
  112.   {"pop2",  "pop two two operand stack words"},
  113.   {"dup",  "duplicate top operand stack word"},
  114.   {"dup_x1",  "duplicate top operand stack word and put two down"},
  115.   {"dup_x2",  "duplicate top operand stack word and put three down"},
  116.   {"dup2",  "duplicate top two operand stack words"},
  117.   {"dup2_x1",  "duplicate top two operand stack words and put three down"},
  118.   {"dup2_x2",  "duplicate top two operand stack words and put four down"},
  119.   {"swap",  "swap top two operand stack words"},
  120.   {"iadd",  "add int"},
  121.   {"ladd",  "add long"},
  122.   {"fadd",  "add float"},
  123.   {"dadd",  "add double"},
  124.   {"isub",  "subtract int"},
  125.   {"lsub",  "subtract long"},
  126.   {"fsub",  "substract float"},
  127.   {"dsub",  "subtract double"},
  128.   {"imul",  "multiply int"},
  129.   {"lmul",  "multiply long"},
  130.   {"fmul",  "multiply float"},
  131.   {"dmul",  "multiply double"},
  132.   {"idiv",  "divide int"},
  133.   {"ldiv",  "divide long"},
  134.   {"fdiv",  "divide float"},
  135.   {"ddiv",  "divide double"},
  136.   {"irem",  "remainder int"},
  137.   {"lrem",  "remainder long"},
  138.   {"frem",  "remainder float"},
  139.   {"drem",  "remainder double"},
  140.   {"ineg",  "negate int"},
  141.   {"lneg",  "negate long"},
  142.   {"fneg",  "negate float"},
  143.   {"dneg",  "negate double"},
  144.   {"ishl",  "shift left int"},
  145.   {"lshl",  "shift left long"},
  146.   {"ishr",  "shift right int"},
  147.   {"lshr",  "shift right long"},
  148.   {"iushr",  "logical shift right int"},
  149.   {"lushr",  "logical shift right long"},
  150.   {"iand",  "boolean and int"},
  151.   {"land",  "boolean and long"},
  152.   {"ior",  "boolean or int"},
  153.   {"lor",  "boolean or long"},
  154.   {"ixor",  "boolean xor int"},
  155.   {"lxor",  "boolean xor long"},
  156.   {"iinc",  "increment local variable by constant"},
  157.   {"i2l",  "convert int to long"},
  158.   {"i2f",  "convert int to float"},
  159.   {"i2d",  "convert int to double"},
  160.   {"l2i",  "convert long to int"},
  161.   {"l2f",  "convert long to float"},
  162.   {"l2d",  "convert long to double"},
  163.   {"f2i",  "convert float to int"},
  164.   {"f2l",  "convert float to long"},
  165.   {"f2d",  "convert float to double"},
  166.   {"d2i",  "convert double to int"},
  167.   {"d2l",  "convert double to long"},
  168.   {"d2f",  "convert double to float"},
  169.   {"i2b",  "convert int to byte"},
  170.   {"i2c",  "convert int to char"},
  171.   {"i2s",  "convert int to short"},
  172.   {"lcmp",  "compare long"},
  173.   {"fcmpl",  "compare float less"},
  174.   {"fcmpg",  "compare float greater"},
  175.   {"dcmpl",  "compare double less"},
  176.   {"dcmpg",  "compare double greater"},
  177.   {"ifeq",  "branch if int eq zero"},
  178.   {"ifne",  "branch if int ne zero"},
  179.   {"iflt",  "branch if int lt zero"},
  180.   {"ifge",  "branch if int ge zero"},
  181.   {"ifgt",  "branch if int gt zero"},
  182.   {"ifle",  "branch if int le zero"},
  183.   {"if_icmpeq",  "branch if int comparison eq"},
  184.   {"if_icmpne",  "branch if int comparison ne"},
  185.   {"if_icmplt",  "branch if int comparison lt"},
  186.   {"if_icmpge",  "branch if int comparison ge"},
  187.   {"if_icmpgt",  "branch if int comparison gt"},
  188.   {"if_icmple",  "branch if int comparison le"},
  189.   {"if_acmpeq",  "branch if reference comparison eq"},
  190.   {"if_acmpne",  "branch if reference comparison ne"},
  191.   {"goto",  "branch always"},
  192.   {"jsr",  "jump subroutine"},
  193.   {"ret",  "return from subroutine"},
  194.   {"tableswitch",  "access jump table by index and jump"},
  195.   {"lookupswitch",  "access jump table by key match and jump"},
  196.   {"ireturn",  "return int from method"},
  197.   {"lreturn",  "return long from method"},
  198.   {"freturn",  "return float from method"},
  199.   {"dreturn",  "return double from method"},
  200.   {"areturn",  "return reference from method"},
  201.   {"return",  "return void from method"},
  202.   {"getstatic",  "get static field from class"},
  203.   {"putstatic",  "set static field in class"},
  204.   {"getfield",  "fetch field from object"},
  205.   {"putfield",  "set field in object"},
  206.   {"invokevirtual",  "invoke instance method; dispatch based on runtime type"},
  207.   {"invokenonvirtual",  "invoke instance method; dispatch based on compile-time type"},
  208.   {"invokestatic",  "invoke a class (static) method"},
  209.   {"invokeinterface",  "invoke interface method"},
  210.   {"xxxunusedxxx",  "xxxunusedxxx"},
  211.   {"new",  "create new object"},
  212.   {"newarray",  "create new array"},
  213.   {"anewarray",  "create new array of references"},
  214.   {"arraylength",  "get length of array"},
  215.   {"athrow",  "throw exception or error"},
  216.   {"checkcast",  "check whether object is of given type"},
  217.   {"instanceof",  "determine if object is of given type"},
  218.   {"monitorenter",  "enter monitor for object"},
  219.   {"monitorexit",  "exit monitor for object"},
  220.   {"wide",  "extend local variable index by additional bytes"},
  221.   {"multianewarray",  "create new multidimensional array"},
  222.   {"ifnull",  "branch if reference is null"},
  223.   {"ifnonnuull",  "branch if reference not null"},
  224.   {"goto_w",  "branch always (wide index) ?"},
  225.   {"jsr_w",  "jump subroutine (wide index)"}
  226.         };
  227.  
  228.         if (opc==OP_SOFTWARE) {                                 // software
  229.                  *name = *desc = "software";
  230.          }
  231.          else if (opc == OP_HARDWARE) {                 // hardware
  232.                  *name = *desc = "hardware";
  233.          }
  234.          else if (opc >=0 && opc <= 0xc9) {
  235.                  *name = table[opc].op_name;
  236.                  *desc = table[opc].op_desc;
  237.          }
  238.          else {
  239.                  *name = *desc = "illegal";
  240.          }
  241. }
  242. #define INFO_NONE       0
  243. #define INFO_LOCAL      1
  244. #define INFO_CONST      2
  245. #define INFO_DONE       3
  246. // set code to be array of opcodes, codei to be code index
  247. static void chaos(char * str) {
  248.         cout << "chaos: " << str << "\n";
  249.         cerr << "chaos: " << str << "\n";
  250.         exit(1);
  251. }
  252.  
  253. signed char get_i1(DynamicArray<u1>& code, int pc) {
  254.         return code[pc];
  255. }
  256. short get_i2(DynamicArray<u1>& code, int pc) {
  257.         return  code[pc] << 8 | code[pc+1];
  258. }
  259. int get_i4(DynamicArray<u1>& code, int pc) {
  260.         return  code[pc] << 24 | code[pc+1] << 16 | code[pc+2] << 8 | code[pc+3];
  261. }
  262. unsigned int get_u1(DynamicArray<u1>& code, int pc) {
  263.         unsigned val;
  264.         val = code[pc];
  265.         return val;
  266. }
  267. unsigned int get_u2(DynamicArray<u1>& code, int pc) {
  268.         unsigned int val;
  269.         val = (code[pc] << 8 | code[pc+1]);
  270.         return val;
  271. }
  272. unsigned int get_u4(DynamicArray<u1>& code, int pc) {
  273.         unsigned int val;
  274.         val = (code[pc] << 24 | code[pc+1] << 16 | code[pc+2] << 8 | code[pc+3]);
  275.         return val;
  276. }
  277. extern void const_string(DynamicArray<cp_info *>& constant_pool, int indx);
  278. void opline(DynamicArray<cp_info *>& constant_pool,char * hdr, int pc, int opc, char *name,
  279.                         char* args, char* desc,
  280.                         int info_kind, int info_index)
  281. {
  282.         int len;
  283.         // generate line of opcode dump, info is extra info
  284.  
  285.         cout<< *hdr;
  286.         cout.width(4);
  287.         cout << pc;
  288.         cout << "\t" << name;
  289.         len = strlen(name);
  290.         if (strlen(args)) {
  291.                 cout << " " << args;
  292.                 len += (strlen(args) + 1);
  293.         }
  294.         if (len < 8) cout << "\t\t\t";
  295.         else if (len < 16) cout << "\t\t";
  296. //      else if (len <= 24) cout << "\t";
  297.         else cout << "\t";
  298.         switch (info_kind) {
  299.                 case INFO_CONST:
  300.                         cout << " ";
  301.                         if (info_index<=0 || info_index >constant_pool.length()) {
  302.                                 cout << "OUT-OF_BOUNDS CONSTANT_POOL-INDEX " << info_index;
  303.                         }
  304.                         else {
  305. //                              constant_pool[info_index]->describe(constant_pool);
  306.                         }
  307.                         break;
  308.                 case INFO_LOCAL:
  309.                         cout << " local#" << info_index;
  310.                         break;
  311.         }
  312. // DS (17 jun) - skip desc for now: it's too long and shoud only
  313.         // be written at user request.
  314. //      cout <<" " << desc;
  315.         cout << "\n";
  316. }
  317.  
  318. extern void opdesc(unsigned opc, char ** name, char ** desc);
  319.  
  320. void  opdmp(DynamicArray<cp_info *>& constant_pool, DynamicArray<u1>& code){
  321.         char argdesc[100];
  322.         int pc_max = code.length();
  323.         int pc_start;
  324.         unsigned opc;
  325.         unsigned int au1,au2;
  326.         int ai1,ai2,ai4;
  327.         int info_kind;
  328.         int info_index;
  329.         char *name, *desc;                      // set to name (mnemonic) and description of opcode.
  330.         int pc=0;
  331.         while (pc <pc_max) {
  332. //      for (pc=0; pc<pc_max; pc++) {
  333.                 info_kind = INFO_NONE;                  // assume no extra info
  334.                 info_index=0;
  335.                 pc_start = pc;
  336.                 opc = get_u1(code,pc);
  337.                 opdesc(code[pc_start], &name, &desc);
  338.                 pc++;
  339.                 argdesc[0] = '\0';                              // assume no argument description needed
  340.                 switch (opc) {
  341.                         case OP_BIPUSH:
  342.                                 ai1 = get_i1(code,pc); pc++;
  343.                                 sprintf(argdesc,"%d",ai1);
  344.                                 break;
  345.                         case OP_SIPUSH:
  346.                                 ai2 = get_i2(code,pc); pc +=2;
  347.                                 sprintf(argdesc,"%d",ai2);
  348.                                 break;
  349.                         case OP_LDC:
  350.                                 info_index = get_u1(code,pc); pc++;
  351.                                 sprintf(argdesc,"%d",info_index);
  352.                                 info_kind = INFO_CONST;
  353.                                 break;
  354.                         case OP_LDC_W:
  355.                         case OP_LDC2_W:
  356.                                 info_index = get_u2(code,pc);pc +=2;
  357.                                 sprintf(argdesc, "%u",info_index);
  358.                                 info_kind = INFO_CONST;
  359.                                 break;
  360.                         case OP_ILOAD:
  361.                         case OP_LLOAD:
  362.                         case OP_FLOAD:
  363.                         case OP_DLOAD:
  364.                         case OP_ALOAD:
  365.                         case OP_ISTORE:
  366.                         case OP_LSTORE:
  367.                         case OP_FSTORE:
  368.                         case OP_DSTORE:
  369.                         case OP_ASTORE:
  370.                                 info_index = get_u1(code,pc);pc++;
  371.                                 sprintf(argdesc, "%u",info_index);
  372.                                 info_kind = INFO_LOCAL;
  373.                                 break;
  374.                         case OP_ILOAD_0:
  375.                         case OP_LLOAD_0:
  376.                         case OP_FLOAD_0:
  377.                         case OP_DLOAD_0:
  378.                         case OP_ALOAD_0:
  379.                         case OP_ISTORE_0:
  380.                         case OP_LSTORE_0:
  381.                         case OP_FSTORE_0:
  382.                         case OP_DSTORE_0:
  383.                         case OP_ASTORE_0:
  384.                                 info_kind = INFO_LOCAL;
  385.                                 info_index = 0;
  386.                                 break;
  387.                         case OP_ILOAD_1:
  388.                         case OP_LLOAD_1:
  389.                         case OP_FLOAD_1:
  390.                         case OP_DLOAD_1:
  391.                         case OP_ALOAD_1:
  392.                         case OP_ISTORE_1:
  393.                         case OP_LSTORE_1:
  394.                         case OP_FSTORE_1:
  395.                         case OP_DSTORE_1:
  396.                         case OP_ASTORE_1:
  397.                                 info_kind = INFO_LOCAL;
  398.                                 info_index = 1;
  399.                                 break;
  400.                         case OP_ILOAD_2:
  401.                         case OP_LLOAD_2:
  402.                         case OP_FLOAD_2:
  403.                         case OP_DLOAD_2:
  404.                         case OP_ALOAD_2:
  405.                         case OP_ISTORE_2:
  406.                         case OP_LSTORE_2:
  407.                         case OP_DSTORE_2:
  408.                         case OP_FSTORE_2:
  409.                         case OP_ASTORE_2:
  410.                                 info_kind = INFO_LOCAL;
  411.                                 info_index = 2;
  412.                                 break;
  413.                         case OP_ILOAD_3:
  414.                         case OP_LLOAD_3:
  415.                         case OP_FLOAD_3:
  416.                         case OP_DLOAD_3:
  417.                         case OP_ALOAD_3:
  418.                         case OP_ISTORE_3:
  419.                         case OP_LSTORE_3:
  420.                         case OP_FSTORE_3:
  421.                         case OP_DSTORE_3:
  422.                         case OP_ASTORE_3:
  423.                                 info_kind= INFO_LOCAL;
  424.                                 info_index = 3;
  425.                                 break;
  426.                         case OP_IINC:
  427. //                              info_index = get_u1(code,pc); pc++;
  428.                                 au1 = get_u1(code,pc); pc++;
  429.                                 ai1 = get_i1(code,pc); pc++;
  430.                                 info_kind = INFO_LOCAL;
  431.                                 sprintf(argdesc,"%d %d",au1,ai1);
  432.                                 break;
  433.                         case OP_IFEQ:
  434.                         case OP_IFNE:
  435.                         case OP_IFLT:
  436.                         case OP_IFGE:
  437.                         case OP_IFGT:
  438.                         case OP_IFLE:
  439.                         case OP_IF_ICMPEQ:
  440.                         case OP_IF_ICMPNE:
  441.                         case OP_IF_ICMPLT:
  442.                         case OP_IF_ICMPGE:
  443.                         case OP_IF_ICMPGT:
  444.                         case OP_IF_ICMPLE:
  445.                         case OP_IF_ACMPEQ:
  446.                         case OP_IF_ACMPNE:
  447.                         case OP_GOTO:
  448.                         case OP_JSR:
  449.                         case OP_IFNULL:
  450.                         case OP_IFNONNULL: 
  451.                                 ai2 = get_i2(code, pc);
  452.                                 sprintf(argdesc,"%d",(int) ( ai2+pc_start)); // compute branch target
  453.                                 pc +=2;
  454.                                 break;
  455.                         case OP_RET:
  456.                                 au1 = get_u1(code,pc);
  457.                                 pc++;
  458.                                 sprintf(argdesc,"%d",(int)au1);
  459.                                 break;
  460.                         case OP_TABLESWITCH:
  461.                         {
  462.  
  463.                                 int def,low,high,len,val,pc_this,op_this;
  464.                                 unsigned iu1;
  465.                                 op_this = OP_TABLESWITCH;
  466.                                 // account for padding
  467.                                 while (pc % 4) {
  468.                                         iu1 = get_u1(code, pc);
  469.                                         pc++;
  470.                                 }
  471.                                 def = get_i4(code, pc); pc += 4;
  472.                                 low = get_i4(code,pc); pc +=4;
  473.                                 high = get_i4(code,pc); pc += 4;
  474.                                 sprintf(argdesc,"default:%d low:%d high:%d",def+pc_start,low,high);
  475.                                 opline(constant_pool," ",pc_start, opc, name, argdesc, desc,info_kind,info_index);
  476.                                 len =  high - low + 1;
  477.                                 while (len) {
  478.                                         pc_this = pc;
  479.                                         val = get_i4(code,pc);
  480.                                         sprintf(argdesc,"match:%d offset:%d",low++,val+pc_start);
  481.                                         opline(constant_pool,"*",pc_this, op_this,name,argdesc,desc,INFO_NONE,0);
  482.                                         pc += 4;
  483.                                         len--;
  484.                                 }
  485.                                 info_kind=INFO_DONE;
  486.                         }
  487.                         break;
  488.                         case OP_LOOKUPSWITCH:
  489.                         {
  490.                                 int def,npairs,len,match,offset,op_this;
  491.                                 // account for padding
  492.                                 unsigned iu1;
  493.                                 op_this = OP_LOOKUPSWITCH;
  494.                                 while (pc % 4) {
  495.                                         iu1 = get_u1(code, pc);
  496.                                         pc++;
  497.                                 }
  498.                                 def = get_i4(code, pc); pc += 4;
  499.                                 npairs = get_i4(code,pc); pc +=4;
  500.                                 sprintf(argdesc,"default:%d npairs:%d",(def + pc_start), npairs);
  501.                                 opline(constant_pool," ",pc_start, op_this, name, argdesc, desc, info_kind,
  502.                                            info_index);
  503.                                 len = npairs;
  504.                                 while (npairs) {int pcb;
  505.                                     pcb = pc;
  506.                                         match = get_i4(code,pc); pc +=4 ;
  507.                                         offset = get_i4(code,pc); pc +=4;
  508.                                         sprintf(argdesc,"match:%d offset:%d ",match,offset+pc_start);
  509.                                         opline(constant_pool,"*", pcb, op_this, name, argdesc, desc, INFO_NONE,0);
  510.                                         npairs--;
  511.                                 }
  512.                                 info_kind=INFO_DONE;
  513.                         }
  514.                         break;
  515.                         case OP_GETSTATIC:
  516.                         case OP_PUTSTATIC:
  517.                         case OP_GETFIELD:
  518.                         case OP_PUTFIELD:
  519.                         case OP_INVOKEVIRTUAL:
  520.                         case OP_INVOKENONVIRTUAL:
  521.                         case OP_INVOKESTATIC:
  522.                         case OP_NEW:
  523.                         case OP_ANEWARRAY:
  524.                         case OP_CHECKCAST:
  525.                         case OP_INSTANCEOF:
  526.                                 info_index = get_u2(code,pc); pc += 2;
  527.                                 sprintf(argdesc,"%d",info_index);
  528.                                 // generate const_stringing from au2
  529.                                 info_kind = INFO_CONST;
  530.                                 break;
  531.                         case OP_INVOKEINTERFACE:
  532.                         {
  533.  
  534.                                 int nargs;
  535.                                 info_index = get_u2(code,pc); pc += 2;
  536.                                 au1 = get_u1(code,pc); pc++;
  537.                                 nargs = au1;
  538.                                 au1 = get_u1(code,pc); pc++;
  539.                                 if (au1) {
  540.                                         chaos("zero byte required in this position");
  541.                                 }
  542.                                 sprintf(argdesc,"%d %d",nargs,info_index);
  543.                                 info_kind=INFO_CONST;
  544.                         }
  545.                         break;
  546.                         case OP_NEWARRAY:
  547.                                 au1 = get_u1(code,pc); pc++;
  548.                                 switch(au1) {
  549.                                   case 4: sprintf(argdesc,"%s","BOOLEAN");break;
  550.                                   case 5: sprintf(argdesc,"%s","CHAR");break;
  551.                                   case 6: sprintf(argdesc,"%s","FLOAT");break;
  552.                                   case 7: sprintf(argdesc,"%s","DOUBLE");break;
  553.                                   case 8: sprintf(argdesc,"%s","BYTE");break;
  554.                                   case 9: sprintf(argdesc,"%s","SHORT");break;
  555.                                   case 10: sprintf(argdesc,"%s","INT");break;
  556.                                   case 11: sprintf(argdesc,"%s","LONG");break;
  557.                                   default:
  558.                                         sprintf(argdesc,"%s","<UNKNOWN>");break;
  559.                                 }
  560.                                 break;
  561.                         case OP_WIDE:
  562.                                 chaos("dmp for op_wide not supported yet");
  563.                                 break;
  564.                         case OP_MULTIANEWARRAY:
  565.                                 info_index = get_u2(code,pc); pc += 2;
  566.                                 au1 = get_u1(code,pc); pc++;
  567.                                 info_kind = INFO_CONST;
  568.                                 // au1 gives dimensions
  569.                                 sprintf(argdesc,"%u",au1);
  570.                                 break;
  571.                         case OP_GOTO_W:
  572.                         case OP_JSR_W:
  573.                                 ai4 = get_i4(code,pc); pc += 4;
  574.                                 // ai4 gives offset (wide) of branch target
  575.                                 sprintf(argdesc,"%d", pc_start + ai4);
  576.                                 break;
  577.                         default:
  578.                                 break;
  579.                 }
  580.                 // output first part of description
  581.                 if (info_kind!=INFO_DONE) opline(constant_pool," ",pc_start, opc, name, argdesc, desc,info_kind,info_index);
  582.         }
  583. }
  584.